[WC-3442] feat(datagrid-web): add onBeforeExport and onAfterExport event actions - #2392
[WC-3442] feat(datagrid-web): add onBeforeExport and onAfterExport event actions#2392r0b1n wants to merge 4 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
e1fc392 to
5134ce1
Compare
This comment has been minimized.
This comment has been minimized.
5134ce1 to
5bace00
Compare
This comment has been minimized.
This comment has been minimized.
- Narrow AfterExportArgs.status to "success" | "aborted" union type - Move onBeforeExport callback before handler(req) to match spec ordering - Update openspec artifacts to replace filterCondition with fileName/sheetName and document the intentional removal of filterCondition
5bace00 to
158efd6
Compare
AI Code Review
What was reviewed
Skipped (out of scope): All CI checks could not be fetched (command requires approval in this environment). Findings
|
Summary
onBeforeExportfires fire-and-forget immediately before the first datasource page fetch; receivesgridName,columnTitles,chunkSize,fileName,sheetName, andstartTimeonAfterExportfires after the export resolves (success or abort); additionally receivesexportedItemCount,status("success"|"aborted"), andendTimefileNameandsheetNameare passed by the external export caller viaexportData()options and default to empty strings when not providedChanges
Datagrid.xml— two new<property type="action">blocks with<actionVariables>in the Events groupDatagridProps.d.ts— updated manually to match XML (will be regenerated on build)DSExportRequest.ts— exposedget loaded()andget limit()public getters (renamed private fields to_loaded/_limit)ExportController.ts— addedBeforeExportArgs/AfterExportArgstypes;nameconstructor param;beforeexport/afterexportevents inControllerEvents; publicon()method (returnsUnsubscribe); emits both events inexportData()useDataExport.ts— stores latestActionValueprops in refs; subscribes tobeforeexport/afterexportonce per controller lifetime viauseEffect([entry]); effect cleanup unsubscribes automaticallyExportController.spec.ts— 5 new unit tests covering all event scenariosTest plan
pnpm run test)onBeforeExportandonAfterExporton a Data Grid 2, trigger an export, verify both microflows/nanoflows are called with correct variable valuesstatusis"aborted"when the user cancels mid-export